/*
 * Library.java
 *
 * Created on February 26, 2007, 12:17 PM
 *
 * (C) R. Alexander Milowski alex@milowski.com
 */

package com.smallx.xproc.library;

import java.net.URI;
import org.infoset.component.ComponentRegistry;
import org.infoset.component.ComponentRegistryReader;
import org.infoset.xml.XMLException;

/**
 *
 * @author R. Alexander Milowski
 */
public class Library {
   
   static final Library instance = new Library();
   public static final URI REGISTRY_DOCUMENT = URI.create(instance.getClass().getResource("registry.xml").toString());
   
   
   public static ComponentRegistry getRegistry() 
      throws XMLException
   {
      if (instance.registry==null) {
         synchronized (instance) {
            instance.registry = ComponentRegistryReader.getInstance().read(REGISTRY_DOCUMENT);
            instance.registry.getSubordinate().add(org.infoset.component.library.Library.getRegistry());
         }
      }
      return instance.registry;
   }
   
   ComponentRegistry registry = null;
   
   /** Creates a new instance of Library */
   private Library() {
   }
   
}
